<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<!-- import CSS -->
		<link rel="stylesheet" href="/jeefast/mb/elementui-lib/lib/index.css">
		<link rel="stylesheet" href="/jeefast/mb/css/common.css">
		<title>项目管理</title>
	</head>
	<body>
		<div id="app" v-cloak>
			<div class="pd10 border-bottom ft-14">项目管理</div>
			<div class="pd10">
				<el-form ref="form" :model="form" label-width="100px">
					<el-form-item label="项目:">
						<div class="tagslist">
							<span v-for="(item,index) in tagsArr" :class="{active:tagsIndex == index}" @click="changeTags(item,index)">{{item.projName}}<i
								 class="el-icon-close" @click.stop="deleteTags(item.id,index)"></i></span>
						</div>
						<el-button type="primary" icon="el-icon-plus" size="medium" @click="addProject">添加项目</el-button>
					</el-form-item>
					<el-form-item label="项目名称:">
						<el-input v-model="form.projName" style="width:300px;"></el-input>
					</el-form-item>
					<el-form-item label="发起单位:">
						<el-input v-model="form.projCompany" style="width:300px;"></el-input>
					</el-form-item>
					<div style="width:100%;display:table;">
						<el-form-item label="项目协议书:" style="width:500px;float:left;">
							<el-upload class="avatar-uploader" :action="ImgApiMore" :show-file-list="false" :on-success="handleAgreement"
							 :before-upload="beforeAvatarUpload">
								<img v-if="projAgreement" :src="projAgreement" class="avatar">
								<i v-else class="el-icon-plus avatar-uploader-icon"></i>
								<div slot="tip" class="el-upload__tip mt0">图片尺寸为(由UI设定)px,图片不得超过2M,支持PNG,JPG，JPEG格式</div>
							</el-upload>
						</el-form-item>
						<el-form-item label="项目icon:" style="width:500px;float:left;">
							<el-upload class="avatar-uploader" :action="ImgApiMore" :show-file-list="false" :on-success="handleIcon"
							 :before-upload="beforeAvatarUpload">
								<img v-if="projIcon" :src="projIcon" class="avatar">
								<i v-else class="el-icon-plus avatar-uploader-icon"></i>
								<div slot="tip" class="el-upload__tip mt0">图片尺寸为(由UI设定)px,图片不得超过2M,支持PNG,JPG，JPEG格式</div>
							</el-upload>
						</el-form-item>
					</div>
					<el-form-item label="项目介绍:">
						<el-input type="textarea" :rows="4" v-model="form.projIntroduce" style="width:600px;"></el-input>
					</el-form-item>

					<el-form-item>
						<el-button type="primary" @click="onSubmit">{{message}}</el-button>
					</el-form-item>
				</el-form>
			</div>
			<!-- 医学专员 -->
			<div class="pd10 border-bottom ft-14">医学专员</div>
			<div class="pd10">
				<el-button type="primary" icon="el-icon-plus" @click="addMedical" class="mb10">添加医学专员</el-button>
				<el-table :data="medicalData" stripe border style="width: 100%">
					<el-table-column prop="commAccnount" label="账号"></el-table-column>
					<el-table-column prop="commName" label="姓名"></el-table-column>
					<el-table-column prop="commCompany" label="单位"></el-table-column>
					<el-table-column prop="commCode" label="邀请码"></el-table-column>
					<el-table-column prop="codeUrl" label="邀请二维码地址">
						<template slot-scope="scope">
							<!--<img :src="'http://qr.topscan.com/api.php?text=http://www.uphonechina.com/manbing/index.html?code='+ scope.row.commCode" style="width:100px;height:100px;" />-->
							<img :src="'http://qr.topscan.com/api.php?text=http://medical.medcircle.cn/register/index.html?code='+ scope.row.commCode" style="width:100px;height:100px;" />
						</template>
					</el-table-column>
					<el-table-column label="操作">
						<template slot-scope="scope">
							<el-button @click="handleEditMedical(scope.row)" type="text" size="medium">修改</el-button>
							<el-button @click="handleDeleteMedical(scope.row)" type="text" size="medium" class="color-F56C6C">删除</el-button>
						</template>
					</el-table-column>
				</el-table>
				<!-- 分页 -->
				<div class="bottomstate">
					<el-pagination class="f-r mt5" background @current-change="handleCurrentChange" :current-page="page" :page-size="limit"
					 layout="total,prev, pager, next,jumper" :total="total"></el-pagination>
				</div>
			</div>
			<!-- 调研数据配置 -->
			<div class="pd10 border-bottom ft-14">调研数据配置</div>
			<div class="pd10">
				<el-form ref="form" :model="form" label-width="100px">
					<el-form-item label="研究组:">
						<div class="tagslist">
							<span v-for="(item,index) in researchArr" :class="{active:researchIndex == index}" @click="changeResearch(item,index)">{{item.resName}}<i
								 class="el-icon-close" @click="deleteResearch(item.resId,index)"></i></span>
						</div>
						<el-button type="primary" icon="el-icon-plus" size="medium" @click="addResearch">添加研究组</el-button>
					</el-form-item>
					<el-form-item label="研究阶段:">
						<el-button type="primary" icon="el-icon-plus" size="medium" @click="addResearchStep">添加研究阶段</el-button>
					</el-form-item>
					<el-table :data="researchData" stripe border style="width: 100%">
						<el-table-column prop="stepName" label="阶段名"></el-table-column>
						<el-table-column prop="stepRemark" label="描述"></el-table-column>
						<el-table-column label="起始时间">
							<template slot-scope="scope">
								T0<span v-if="scope.row.mark1 == 0"></span><span v-else-if="scope.row.mark1 < 0">{{scope.row.mark1}}</span><span v-else>+{{scope.row.mark1}}</span>
								<!-- <span v-if="scope.row.days[0]==0">T0</span>
								<span v-else>T0+{{scope.row.days[0]}}</span> -->								
							</template>
						</el-table-column>
						<el-table-column label="截止时间">
							<template slot-scope="scope">
								T0<span v-if="scope.row.mark2 == 0"></span><span v-else-if="scope.row.mark2 < 0">{{scope.row.mark2}}</span><span v-else>+{{scope.row.mark2}}</span>
								<!-- {{scope.row.stepEndTime}} -->
								<!-- T0+{{scope.row.days[1]}} -->
							</template>
						</el-table-column>
						<el-table-column prop="tempName" label="数据模板">
							<template slot-scope="scope">
								{{scope.row.tempName}}
							</template>
						</el-table-column>
						<el-table-column label="操作">
							<template slot-scope="scope">
								<el-button @click="handleResearchClick(scope.row)" type="text" size="medium">修改</el-button>
								<el-button @click="handleDeleteResearch(scope.row)" type="text" size="medium" class="color-F56C6C">删除</el-button>
							</template>
						</el-table-column>
					</el-table>
				</el-form>
			</div>
			<!-- 慢病基本信息 -->
			<div class="pd10 border-bottom ft-14">慢病基本信息</div>
			<div class="pd10">
				<!-- <el-button type="primary" icon="el-icon-plus" class="mb10">添加信息</el-button> -->
				<div class="pd10">
					<el-form ref="form" :model="form">
						<el-form-item>
							<span :class="[resbaseList.dgShow==1?'check_box active':'check_box']" @click="resbaseShow(1,resbaseList.dgShow)"></span>
							<span class="el-form-item__label">治疗方案:</span>
							<div class="tagslist">
								<span v-for="(item,index) in diseaseTag1" class="active" @click="handleAddResBase(item)">{{item.title}}<i
									 class="el-icon-close" @click.stop="deleteResBase(item)"></i></span>
							</div>
							<el-button type="primary" icon="el-icon-plus" size="medium" @click="handleAddResBase('')">添加</el-button>
						</el-form-item>
						<el-form-item>
							<span :class="[resbaseList.dwShow==1?'check_box active':'check_box']" @click="resbaseShow(2,resbaseList.dwShow)"></span>
							<span class="el-form-item__label">透析方式:</span>
							<div class="tagslist">
								<span v-for="(item,index) in diseaseTag2" class="active" @click="handleAddWay(item)">{{item.title}}<i
									 class="el-icon-close" @click.stop="deleteResBase(item)"></i></span>
							</div>
							<el-button type="primary" icon="el-icon-plus" size="medium" @click="handleAddWay('')">添加</el-button>
						</el-form-item>
						<el-form-item>
							<span :class="[resbaseList.tpShow==1?'check_box active':'check_box']" @click="resbaseShow(3,resbaseList.tpShow)"></span>
							<span class="el-form-item__label">病因</span>
						</el-form-item>
						<el-button type="primary" @click="resbaseSubmit">保 存</el-button>
					</el-form>
				</div>
			</div>
			<!-- 添加医学专业 -->
			<el-dialog :title="title" :visible.sync="dialogFormVisible">
				<el-form ref="medicalForm" :model="medicalForm" label-width="150px">
					<el-form-item label="账号:">
						<el-input type="text" v-model="medicalForm.commAccnount" style="width:300px;"></el-input>
					</el-form-item>
					<el-form-item label="姓名:">
						<el-input type="text" v-model="medicalForm.commName" style="width:300px;"></el-input>
					</el-form-item>
					<el-form-item label="单位:">
						<el-input type="text" v-model="medicalForm.commCompany" style="width:300px;"></el-input>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogFormVisible = false">取 消</el-button>
					<el-button type="primary" @click="medicalSubmit">保 存</el-button>
				</div>
			</el-dialog>
			<!-- 添加研究组 -->
			<el-dialog :title="title" :visible.sync="dialogResearchVisible">
				<el-form ref="researchForm" :model="researchForm" label-width="150px">
					<el-form-item label="研究组名称:">
						<el-input type="text" v-model="researchForm.resName" style="width:300px;"></el-input>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogResearchVisible = false">取 消</el-button>
					<el-button type="primary" @click="researchSubmit">保 存</el-button>
				</div>
			</el-dialog>
			<!-- 添加治疗方案 -->
			<el-dialog :title="title" :visible.sync="dialogtreatmentVisible">
				<el-form ref="treatmentForm" :model="treatmentForm" label-width="150px">
					<el-form-item label="药品名称:">
						<el-input type="text" v-model="treatmentForm.title" style="width:300px;" placeholder="请输入药品名称"></el-input>
					</el-form-item>
					<el-form-item label="单位:">
						<el-input type="text" v-model="treatmentForm.unit" style="width:300px;" placeholder="请输入用量单位"></el-input>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogtreatmentVisible = false">取 消</el-button>
					<el-button type="primary" @click="treatmentSubmit">保 存</el-button>
				</div>
			</el-dialog>
			<!-- 透析方式 -->
			<el-dialog :title="title" :visible.sync="dialogwayVisible">
				<el-form ref="wayForm" :model="wayForm" label-width="150px">
					<el-form-item label="透析方式:">
						<el-input type="text" v-model="wayForm.title" style="width:300px;" placeholder="请输入透析方式"></el-input>
					</el-form-item>
				</el-form>
				<div slot="footer" class="dialog-footer">
					<el-button @click="dialogwayVisible
					 = false">取 消</el-button>
					<el-button type="primary" @click="wayListSubmit">保 存</el-button>
				</div>
			</el-dialog>
			
		</div>
	</body>
	<script src="/jeefast/mb/elementui-lib/lib/vue.js"></script>
	<script src="/jeefast/mb/elementui-lib/lib/index.js"></script>
	<script src="/jeefast/mb/js/jquery-1.9.1.min.js"></script>
	<script src="/jeefast/mb/js/axios.js"></script>
	<script src="/jeefast/mb/js/data.js"></script>
	<script>
		var app = new Vue({
			el: "#app",
			mixins: [mix],
			data: function() {
				return {
					ImgbaseUrl: ImgbaseUrl, //图片路径
					tagsIndex: 0,
					tagsArr: [],
					form: {
						projName: "", //项目名称
						projCompany: "", //发起单位
						projAgreement: "", //项目协议书
						projIcon: "", //项目icon
						projIntroduce: "", //介绍
					},
					// 上传图片					
					ImgApiMore: uploadPic,
					projAgreement: "", //项目协议书
					projIcon: "", //项目icon
					message: "修改当前设置", //提示
					projId: "", //项目id
					resId:"", //研究组Id
					// 医学专员
					title: "",
					dialogFormVisible: false,
					medicalForm: {
						commAccnount: "",
						commName: "",
						commCompany: "",
					},
					medicalData: [],
					total: 0,
					// 研究数据调研设置
					researchIndex: 0,
					researchArr: [],
					researchData: [],
					dialogResearchVisible: false,
					researchForm: {
						resName: ""
					},
					// 慢病基本信息
					resbaseList:{},
					diseaseTag1: [],
					diseaseTag2: [],
					dialogtreatmentVisible:false, //治疗方案
					treatmentForm:{
						projId:"",
						title:"",
						unit:"",
						tpId:""
					},
					// 透析方式
					dialogwayVisible:false, //治疗方案
					wayForm:{
						title:"",
					}
				}
			},
			methods: {
				// 分页
				handleCurrentChange: function(currentPage) {
					this.page = currentPage;
					this.getCommissionerList();  //医学专业列表
				},
				// 项目列表
				getProjList: function() {
					projList({}).then(res => {
						if (res.data.code == 0) {
							this.tagsArr = res.data.data;
							// 详情
							this.form = res.data.data[0];
							this.projAgreement = ImgbaseUrl + res.data.data[0].projAgreement;
							this.projIcon = ImgbaseUrl + res.data.data[0].projIcon;
							this.projId = res.data.data[0].id;

							this.getCommissionerList(this.projId); //医学专业列表
							this.getResearchList(this.projId); //研究组列表							
							
							localStorage.setItem('projName',res.data.data[0].projName)
						}
					})
				},
				// 切换项目
				changeTags: function(item, index) {
					this.tagsIndex = index;
					this.message = "修改当前设置";
					this.getProjDetail(11)
					// this.getProjDetail(item.id);  //项目详情
					// localStorage.setItem('projName',item.projName)
				},
				// 项目详情
				getProjDetail: function(id) {
					projDetail({
						id: id
					}).then(res => {
						if (res.data.code == 0) {
							this.form = res.data.data;
							this.projAgreement = ImgbaseUrl + res.data.data.projAgreement;
							this.projIcon = ImgbaseUrl + res.data.data.projIcon;
							this.projId = res.data.data.id;
							this.getCommissionerList(this.projId); //医学专业列表
							this.getResearchList(this.projId) //研究组列表
						}
					})
				},
				// 移除项目
				deleteTags(id, index) {
					let that = this;
					that.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						projDelete({
							id: id
						}).then(res => {
							if (res.data.code == 0) {
								that.$message({
									type: 'success',
									message: '删除成功!'
								});
								that.tagsIndex = 0;
								that.getProjList()
							}
						})
					}).catch(() => {
						that.$message({
							type: 'info',
							message: '已取消删除'
						});
					});
				},
				// 添加项目
				addProject: function() {
					this.tagsIndex = -1;
					// 清空
					this.form = {}
					this.projAgreement = "";
					this.projIcon = "";
					this.message = "保存当前设置";
				},
				/* 单张上传项目协议书图片 */
				handleAgreement: function(res, file) {
					console.log(file)
					this.projAgreement = URL.createObjectURL(file.raw);
					this.form.projAgreement = file.response.path;
				},
				/* 单张上传项目icon图片 */
				handleIcon: function(res, file) {
					this.projIcon = URL.createObjectURL(file.raw);
					this.form.projIcon = file.response.path;
				},
				// 图片尺寸/大小
				beforeAvatarUpload(file) {
					const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
					const isLt2M = file.size / 1024 / 1024 < 2;

					if (!isJPG) {
						this.$message.error('图片支持PNG,JPG，JPEG格式!');
					}
					if (!isLt2M) {
						this.$message.error('上传图片大小不能超过 2MB!');
					}
					return isJPG && isLt2M;
				},
				// 验证
				IsNullProj: function() {
					let flag = false;
					if (this.form.projName == "" || this.form.projName == null) {
						this.$message.error("项目名称不能为空");
						return flag = true;
					}
					if (this.form.projCompany == "" || this.form.projCompany == null) {
						this.$message.error("发起单位不能为空");
						return flag = true;
					}
					if (this.form.projAgreement == "" || this.form.projAgreement == null) {
						this.$message.error("项目协议书不能为空");
						return flag = true;
					}
					if (this.form.projIcon == "" || this.form.projIcon == null) {
						this.$message.error("项目icon不能为空");
						return flag = true;
					}
					if (this.form.projIntroduce == "" || this.form.projIntroduce == null) {
						this.$message.error("项目介绍不能为空");
						return flag = true;
					}
				},
				// 保存当前设置
				onSubmit: function() {
					let that = this;
					let message = "";
					if (that.IsNullProj()) {
						return;
					}
					if (that.form.id) {
						message = '修改成功'
					} else {
						message = '保存成功'
					}
					// 添加或编辑项目
					addOrSave(that.form).then(res => {
						if (res.data.code == 0) {
							that.$message.success(message);
							if (message == '保存成功') {
								that.getProjList();
								that.tagsIndex = 0
							}
							that.message = "修改当前设置"
						}
					})
				},
				/*
				 * 医学专员
				 * */
				// 医学专业列表
				getCommissionerList: function(id) {
					commissionerList({
						projId: id,
						page: this.page, //起始页面
						limit: this.limit, //每页显示个数	
					}).then(res => {
						if (res.data.code == 0) {
							this.medicalData = res.data.data;
							this.total = res.data.count
						}
					})
				},
				// 添加医学专业
				addMedical: function() {
					this.dialogFormVisible = true;
					this.title = '添加医学专员';
					this.medicalForm = {}
				},
				IsNullMedical: function() {
					let flag = false;
					if (this.medicalForm.commAccnount == "" || this.medicalForm.commAccnount == null) {
						this.$message.warning("医学专员账号不能为空");
						return flag = true;
					}
					if (this.medicalForm.commName == "" || this.medicalForm.commName == null) {
						this.$message.warning("医学专员姓名不能为空");
						return flag = true;
					}
					if (this.medicalForm.commCompany == "" || this.medicalForm.commCompany == null) {
						this.$message.warning("医学专员单位不能为空");
						return flag = true;
					}
				},
				medicalSubmit: function() {
					let that = this;
					let message = "";
					that.medicalForm.projId = that.projId;
					if (that.medicalForm.commId) {
						that.medicalForm.commId = that.medicalForm.commId
					}
					if (that.IsNullMedical()) {
						return;
					}
					commissionerAddOrSave(that.medicalForm).then(res => {
						if (res.data.code == 0) {
							that.$message.success('保存成功')
							that.dialogFormVisible = false;
							that.getCommissionerList(that.projId) //医学专业列表
						}
					})
					// console.log(that.medicalForm)
				},
				// 修改
				handleEditMedical: function(row) {
					this.dialogFormVisible = true;
					this.title = '修改医学专员';
					this.medicalForm = row
				},
				// 删除
				handleDeleteMedical: function(row) {
					let that = this;
					that.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						commissionerDelete({
							commId: row.commId
						}).then(res => {
							if (res.data.code == 0) {
								that.$message.success('删除成功')
								that.getCommissionerList(row.projId) //医学专业列表
							}
						})
					}).catch(() => {
						that.$message({
							type: 'info',
							message: '已取消删除'
						});
					});
				},
				/*
				 * 研究组列表
				 * */
				getResearchList: function(id) {
					researchList({
						projId: id
					}).then(res => {
						if (res.data.code == 0) {
							this.researchArr = res.data.data
							if (res.data.data.length == 0) {
								this.researchData = []   //研究阶段
							} else {
								this.resId = res.data.data[0].resId
								this.getResearchStepList(this.resId)  //获取研究阶段
								this.getResBsaseInfoList(this.projId,this.resId)   //获取慢病基本信息
								localStorage.setItem('resName',res.data.data[0].resName)
							}
						}
					})
				},
				// 切换研究组
				changeResearch: function(item, index) {
					this.researchIndex = index;
					this.resId = item.resId;
					this.getResearchStepList(this.resId)   //获取研究阶段
					this.getResBsaseInfoList(this.projId,this.resId)   //获取慢病基本信息
					localStorage.setItem('resName',item.resName)
				},
				// 研究阶段列表
				getResearchStepList: function(id) {
					researchStepList({
						resId: id
					}).then(res => {
						if (res.data.code == 0) {
							this.researchData = res.data.data
						}
					})
				},
				// 添加研究组
				addResearch: function() {
					this.title = "添加研究组"
					this.dialogResearchVisible = true
				},
				// 添加研究阶段
				addResearchStep: function() {
					window.location.href = 'researchPhase.html?resId='+this.resId+"&projId="+this.projId;//此处拼接内容
				},
				// 修改研究阶段
				handleResearchClick:function(row){
					window.location.href = 'researchPhase.html?resId='+row.resId+"&stepId="+row.stepId+"&projId="+this.projId;//此处拼接内容
				},
				// 删除研究阶段
				handleDeleteResearch:function(row){
					console.log(row)
					let that = this;
					that.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						researchStepDelete({
							stepId:row.stepId
						}).then(res => {
							if (res.data.code == 0) {
								that.$message.success('删除成功')
								this.getResearchStepList(row.resId) //研究阶段列表
							}
						})
					}).catch(() => {
						that.$message({
							type: 'info',
							message: '已取消删除'
						});
					});
				},
				researchSubmit: function() {
					this.researchForm.projId = this.projId
					if (this.researchForm.resName == "") {
						this.$message.warning('研究组名称不能为空')
						return;
					}
					researchAddOrSave(this.researchForm).then(res => {
						if (res.data.code == 0) {
							this.$message.success('添加成功')
							this.dialogResearchVisible = false
							this.getResearchList(this.projId)
							this.researchIndex = 0
						}
					})
				},
				// 移除研究组
				deleteResearch(id, index) {
					let that = this;
					that.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						researchDelete({
							resId: id
						}).then(res => {
							if (res.data.code == 0) {
								that.$message({
									type: 'success',
									message: '删除成功!'
								});
								that.researchIndex = 0;
								that.getResearchList(that.projId)
							}
						})
					}).catch(() => {
						that.$message({
							type: 'info',
							message: '已取消删除'
						});
					});
				},
				// 获取慢病基本信息
				getResBsaseInfoList:function(projId,resId){
					resBsaseInfoList({
						projId:projId,
						resId:resId
					}).then(res=>{
						if(res.data.code==0){
							this.resbaseList = res.data.data
							this.getTreatmentPlanList()      //治疗计划
							this.getDialysisWayList()  //透析方式
						}
					})
				},
				// 治疗计划
				getTreatmentPlanList:function(){
					treatmentPlanList({
						projId:this.projId,
						resId:this.resId
					}).then(res=>{
						if(res.data.code==0){
							this.diseaseTag1 = res.data.data
						}
					})
				},
				// 添加治疗方案
				handleAddResBase:function(item){
					console.log(item)
					this.dialogtreatmentVisible = true
					this.treatmentForm = {}
					if(item){
						this.title = '编辑治疗方案'
						this.treatmentForm = item
					}else{
						this.title = '添加治疗方案'
						this.treatmentForm.projId = this.projId;
						this.treatmentForm.title="";
						this.treatmentForm.unit="";
						this.treatmentForm.tpId="";
					}
				},
				treatmentSubmit:function(){
					if(this.treatmentForm.title == ""){
						this.$message.warning('治疗方案不能为空')
						return;
					}
					treatmentPlanAddOrSave(this.treatmentForm).then(res=>{
						this.$message.success('保存成功')
						this.dialogtreatmentVisible = false
						this.getTreatmentPlanList()
					})
				},
				deleteResBase:function(item){					
					let that = this;
					that.$confirm('此操作将永久删除该记录, 是否继续?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						if(item.tpId){
							treatmentPlanDelete({
								id:item.tpId
							}).then(res=>{
								if (res.data.code == 0) {
									that.$message({
										type: 'success',
										message: '删除成功!'
									});
									that.getTreatmentPlanList()
								}
							})
						}else if(item.dwId){
							dialysisWayDelete({
								id:item.dwId
							}).then(res=>{
								if (res.data.code == 0) {
									that.$message({
										type: 'success',
										message: '删除成功!'
									});
									that.getDialysisWayList()
								}
							})
						}						
					}).catch(() => {
						that.$message({
							type: 'info',
							message: '已取消删除'
						});
					});
				},
				// 透析方式
				getDialysisWayList:function(){
					dialysisWayList({
						projId:this.projId,
						resId:this.resId
					}).then(res=>{
						if(res.data.code==0){
							this.diseaseTag2 = res.data.data
						}
					})
				},
				wayListSubmit:function(){
					if(this.wayForm.title == ""){
						this.$message.warning('透析方式不能为空')
						return;
					}
					this.wayForm.projId = this.projId
					dialysisWayAddOrSave(this.wayForm).then(res=>{
						if(res.data.code==0){
							this.$message.success('保存成功')
							this.dialogwayVisible = false
							this.getDialysisWayList()
						}
					})
				},
				handleAddWay:function(item){
					this.dialogwayVisible = true
					this.wayForm = {}
					if(item){
						this.title = '编辑透析方式'
						this.wayForm = item
					}else{
						this.title = '添加透析方式'
						this.wayForm.projId = this.projId;
						this.wayForm.title="";
						this.wayForm.dwId="";
					}
				},
				// 保存编辑慢病信息
				resbaseSubmit:function(){
					console.log(this.resbaseList)
					resBsaseInfoAddOrSave(this.resbaseList).then(res=>{
						if(res.data.code==0){
							this.$message.success('保存成功')
						}
					})
				},
				// 慢病信息是否显示
				resbaseShow:function(type,show){
					if(type == 1 && show == 1){
						this.resbaseList.dgShow = 0
					}else if(type == 1 && show == 0){
						this.resbaseList.dgShow = 1
					}
					if(type == 2 && show == 1){
						this.resbaseList.dwShow = 0
					}else if(type == 2 && show == 0){
						this.resbaseList.dwShow = 1
					}
					if(type == 3 && show == 1){
						this.resbaseList.tpShow = 0
					}else if(type == 3 && show == 0){
						this.resbaseList.tpShow = 1
					}
				}
			},
			created() {
				this.getProjList(); //项目列表
			},
		});
	</script>
</html>
